package me.magicall.web.simple.spring.controllers;

import me.magicall.web.simple.spring.util.U;
import me.magicall.web.simple.spring.util.UrlPatternRule;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * url设计为：/模块名/add
 * 
 * @author MaGiCalL
 */
@RequestMapping(method = RequestMethod.GET, //
value = UrlPatternRule.SINGULAR_MODEL_NAME + "/add")
@Controller("addController")
public class AddController {

	@RequestMapping
	public String add(final ModelMap modelMap, @PathVariable("modelName") final String modelName) {
		return U.redirect("/" + modelName + "/edit");
	}
}
